﻿<Window x:Class="OctopusGUI.MachineSelect"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Select Machines" Height="300" Width="600" Icon="/OctopusGUI;component/images/logo.ico">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="30"></RowDefinition>
            <RowDefinition Height="*"></RowDefinition>
            <RowDefinition Height="50"></RowDefinition>
        </Grid.RowDefinitions>
        <StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
            <CheckBox Name="ckbSelectAll" Content="All" Checked="CheckBox_Checked" Unchecked="CheckBox_Unchecked" Margin="3"></CheckBox>
        </StackPanel>        
        <ListBox Grid.Row="1" Name="lbMachines" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ItemsSource="{Binding MachineCollection}" SelectionMode="Multiple">
            <ListBox.ItemsPanel>
                <ItemsPanelTemplate>
                    <WrapPanel />
                </ItemsPanelTemplate>
            </ListBox.ItemsPanel>
            <ListBox.ItemTemplate>
                <DataTemplate >                    
                    <CheckBox Margin="2" Content="{Binding Name}" IsChecked="{Binding IsSelected,RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type ListBoxItem}}}" />
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
        <StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Center">
            <Button Content="OK" Name="btnOK" Margin="2" Width="70" Height="26" Click="btnOK_Click"></Button>
            <Button Content="Cancel" Name="btnCancel" Margin="2" Width="70" Height="26" Click="btnCancel_Click"></Button>
        </StackPanel>
        
    </Grid>
</Window>
